﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
    <link rel="stylesheet" href="/template/default/style/style.css" />
    <script src="/js/jquery-1.10.2.js"></script>
    <script src="/js/common.js"></script>
    <script src="/js/jquery_dialog.js"></script>

    <script>
        function checkname() {
            var pass = document.getElementById('tbName').value;
            if (pass.length < 5) {
                document.getElementById('tbName').style.boxShadow = '0 0 0 2px red';
                return false
            }
            else {
                document.getElementById('tbName').style.boxShadow = '0 0 0 2px #00aec7';
                return true;
            }
        }
        function checkpasswd() {
            var pass = document.getElementById('tbPasswd').value;
            if (pass.length < 5) {
                document.getElementById('tbPasswd').style.boxShadow = '0 0 0 2px red';
                return false;
            }
            else {
                document.getElementById('tbPasswd').style.boxShadow = '0 0 0 2px #00aec7';
                return true;
            }
        }
        $(document).ready(function () {
            $('#btnLogin').bind('click', function (e) {
                e.preventDefault();
                if (!checkname()) {
                    document.getElementById('tbName').style.boxShadow = '0 0 0 2px red';
                }
                else
                    document.getElementById('tbName').style.boxShadow = '0 0 0 2px #00aec7';

                if (!checkpasswd()) {
                    document.getElementById('tbPasswd').style.boxShadow = '0 0 0 2px red';
                    return;
                }
                else { document.getElementById('tbPasswd').style.boxShadow = '0 0 0 2px #00aec7'; }
                document.getElementById("resurl").value = getQueryString('resurl');
                login();
            });
        });

        function login() {
            var resurl = document.getElementById("resurl").value;
            var name = document.getElementById("tbName").value;
            var passwd = document.getElementById("tbPasswd").value;
            var cbSave = document.getElementById("cbSave").value;
            ajax_login(name, passwd, resurl, cbSave);
        }
        
        
    </script>

</head>
<body>
        <input type="hidden" value="1" name="resurl" id="resurl">
        <div class="login-main">
            <div class="item"><label>用户名：</label><input id="tbName" name="name" onblur="checkname()" class="tb" type="text" /></div>
            <div class="item"><label>密&nbsp; &nbsp;码：</label><input id="tbPasswd" name="passwd" onblur="checkpasswd()" class="tb" type="password" /></div>
            <div class="item">
                <input class="check" id="cbSave" name="cbSave" type="checkbox" /><label>30天免登陆</label>
                <input value="登陆" type="submit" class="btn" id="btnLogin" />
        </div>
            </div>
</body>
</html>
